using System;
using System.IO;
using System.Windows.Forms;

namespace APP.HELPER.Utils.Shell
{
	public class Shell32
	{
        public static String _YourSoftName;
        public static String _YourCompanyName;
        public static String GetYourSoftName()
        {
            return _YourSoftName;
        }
        public static String SetYourSoftName(String YourSoftName)
        {
            return _YourSoftName = YourSoftName;
        }
        public static String GetYourCompanyName()
        {
            return _YourCompanyName;
        }
        public static String SetYourCompanyName(String YourCompanyName)
        {
            return _YourCompanyName = YourCompanyName;
        }
        public Shell32()
        {
            _YourSoftName = "ERP.SoftWare";
            _YourCompanyName = "KTT ERP Solution";
        }
        public Shell32(String YourSoftName, String YourCompanyName): this()
        {

        }
		public static void CreateShortCutOnDesktop(string shortcutName, string scExecutePath, string scDescription, string scIcon)
		{
			string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
			WebLink.Create(shortcutName, folderPath, scExecutePath, scDescription, scIcon);
		}
		public static void CreateShortCutOnDesktop(string scExecutePath, string scDescription, string scIcon)
		{
			Shell32.CreateShortCutOnDesktop(AssemblyHelper.AssemblyProduct, scExecutePath, scDescription, scIcon);
		}
		public static void CreateShortCutOnDesktop()
		{
			Shell32.CreateShortCutOnDesktop(Application.ExecutablePath, AssemblyHelper.AssemblyDescription, Application.ExecutablePath);
		}
		public static void CreateShortCut(string shortcutName, string scLocation, string scExecutePath, string scDescription, string scIcon)
		{
			WebLink.Create(shortcutName, scLocation, scExecutePath, scDescription, scIcon);
		}
		public static void CreateShortCut(string shortcutName, string scExecutePath, string scDescription, string scIcon)
		{
			string scLocation = Environment.GetFolderPath(Environment.SpecialFolder.Programs) + "\\" + _YourCompanyName + "\\" + _YourSoftName + "\\";
			Shell32.CreateShortCut(shortcutName, scLocation, scExecutePath, scDescription, scIcon);
		}
		public static void CreateShortCut(string scExecutePath, string scDescription, string scIcon)
		{
			Shell32.CreateShortCut(AssemblyHelper.AssemblyTitle, scExecutePath, scDescription, scIcon);
		}
		public static void CreateShortCut(string scDescription, string scIcon)
		{
			Shell32.CreateShortCut(Application.ExecutablePath, scDescription, scIcon);
		}
		public static void CreateShortCut(string scIcon)
		{
			Shell32.CreateShortCut(AssemblyHelper.AssemblyDescription, scIcon);
		}
		public static void CreateShortCut()
		{
			Shell32.CreateShortCut(Application.ExecutablePath);
		}
		public static void CreateShortCutInternet(string shortcutName, string scExecutePath, string scDescription, string scIcon)
		{
			string targetPath = Environment.GetFolderPath(Environment.SpecialFolder.Programs) + "\\" + _YourCompanyName + "\\" + _YourSoftName + "\\";
			WebLink.CreateInternet(shortcutName, targetPath, scExecutePath, scDescription, scIcon);
		}
		public static void CreateShortCutInternetOnDesktop(string shortcutName, string scExecutePath, string scDescription, string scIcon)
		{
			string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
			WebLink.CreateInternet(shortcutName, folderPath, scExecutePath, scDescription, scIcon);
		}
		public static void Create()
		{
			FileInfo fileInfo = new FileInfo(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\" + AssemblyHelper.AssemblyProduct + ".lnk");
			if (!fileInfo.Exists)
			{
				Shell32.CreateShortCutOnDesktop();
				Shell32.CreateShortCut();
                //Shell32.CreateShortCut("Cập Nhật Trực Tuyến", Application.StartupPath + "\\OnlineUpdate.exe", "Cập Nhật Trực Tuyến", Application.StartupPath + "\\OnlineUpdate.exe");
                //Shell32.CreateShortCut("Cập Nhật Thông Thường", Application.StartupPath + "\\OfflineUpdate.exe", "Cập Nhật Thông Thường", Application.StartupPath + "\\OfflineUpdate.exe");
                //Shell32.CreateShortCut("Quản Lý Bản Quyền", Application.StartupPath + "\\KTT.License.exe", "Quản Lý Bản Quyền", Application.StartupPath + "\\KTT.License.exe");
                //Shell32.CreateShortCut("Quản Lý Cơ Sở Dữ Liệu", Application.StartupPath + "\\KTT.Data.exe", "Quản Lý Cơ Sở Dữ Liệu", Application.StartupPath + "\\KTT.Data.exe");
                //Shell32.CreateShortCutInternet("Liên Hệ", "mailto:sale@KTT.com.vn", "Liên Hệ", Application.StartupPath + "\\EML.ico");
                //Shell32.CreateShortCutInternet("Trang Chủ", "http://www.KTT.com.vn/trang-chu.html", "Trang Chủ", Application.StartupPath + "\\IE.ico");
                //Shell32.CreateShortCutInternet("Hướng Dẫn Sử Dụng", "http://www.KTT.com.vn/huong-dan-su-dung-phan-mem-quan-ly-kho.html", "Hướng Dẫn Sử Dụng", Application.StartupPath + "\\HLP.ico");
				//Shell32.CreateShortCutInternetOnDesktop("Công Ty Hoàn Hảo", "http://www.KTT.com.vn/trang-chu.html", "Trang Chủ", Application.StartupPath + "\\IE.ico");
                //string fileName = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData).Replace("Application Data", "") + "\\Desktop\\" + MyControlLib.RejectMarks(AssemblyHelper.AssemblyProduct) + ".lnk";
                //FileInfo fileInfo2 = new FileInfo(fileName);
                //if (fileInfo2.Exists)
                //{
                //    fileInfo2.Delete();
                //}
			}
		}
	}
}
